package main

import (
	"cqsx/bmi.go"
	"cqsx/containers"
	"cqsx/shuxue.go"
	"fmt"
	"os"
	"time"
)

func main() {
amHere:
	for {
		var comand string
		fmt.Println("请输入模块的名字")
		fmt.Println("目前支持bmi,add,jianfa,chengfa,jiafa")
		fmt.Scanln(&comand)
		switch comand {
		case "bmi":
			bmi.BMI()
		case "add":
			shuxue.Add()
		case "jiafa":
		case "luquxian":
			containers.QueryLuquxian()
		case "chengfa":
		case "exit":
		case "array":
			containers.JiaoFenZiQian()
		case "slice":
			containers.InsertStudents()
			break amHere
		}
	}
}
func OpenDir() {
	var dir string
	fmt.Println("请输入你要打开的目录")
	fmt.Scanln(&dir)

	dirfile, err := os.Open(dir)
	if err != nil {
		fmt.Println("打开失败", err)
		return

	}
	studentFiles, err := dirfile.ReadDir(50)
	if err != nil {
		fmt.Println("读取失败", err)
		return
	}
	for _, file := range studentFiles {
		fileinfo, _ := file.Info()
		if time.Now().Add(-time.Hour * 24 * 3).After(fileinfo.ModTime()) {
			fmt.Println("这是一个比较老的文件")
		} else {
			fmt.Println("这是一个三天内被修改的文件")
			fmt.Println(file.Name(), "文件大小:", fileinfo.Size(), "修改时间:", fileinfo.ModTime())

		}
	}
}
